//
//  CPSCServiceListCollectionViewCell.m
//  CollTest
//
//  Created by codew on 9/12/21.
//

#import "CPSCServiceListCollectionViewCell.h"
#import "CPSCServiceListContentNormlView.h"

@interface CPSCServiceListCollectionViewCell ()

/** 商品显示 */
@property (nonatomic, strong) CPSCServiceListContentNormlView * viewNorml;

@end

@implementation CPSCServiceListCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame])
    {
        self.layer.cornerRadius = 12;
        self.layer.masksToBounds = YES;
        
        [self initSubviews];
        [self makeContraints];
    }
    
    return self;
}



- (void)updateCellWithItem:(id)item
{
    // 1. 普通商品显示
    BOOL isNormlView = YES;
    // 2. 热榜
    // 3. 需求调研
    // 4. 有奖调研
    if (isNormlView) {
        
        [self.viewNorml updateViewWithItem:item];
    }
}


#pragma mark--initUI

- (void)initSubviews {
    self.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.viewNorml];
}

- (void)makeContraints {
    
    [self.viewNorml mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.mas_equalTo(0);
    }];
}

#pragma mark - Getter Setter

- (CPSCServiceListContentNormlView *)viewNorml
{
    
    if (!_viewNorml) {
        
        CPSCServiceListContentNormlView * view = [[CPSCServiceListContentNormlView alloc] init];
        view.backgroundColor = [UIColor whiteColor];
        view.clipsToBounds = YES;
        
        _viewNorml = view;
    }
    return _viewNorml;
}

@end
